﻿<UserControl x:Class="AppToolkit.WPF.Services.UserMessageHandling.UI.MessageView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cnv="clr-namespace:AppToolkit.WPF.Services.UserMessageHandling.UI"
    Height="80" Width="300" HorizontalAlignment="Left" VerticalAlignment="Bottom" Background="#FFA1A7CE" 
    Visibility="{Binding Path=ShowInfo,Converter={StaticResource cnvVisibility}}"
    IsKeyboardFocusWithinChanged="OnFocusChanged">
    
    <UserControl.Resources>
        <cnv:SeverityConverter x:Key="cnvSeverity" />
    </UserControl.Resources>
    
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="52*" />
            <ColumnDefinition Width="248*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="12" />
            <RowDefinition Height="26"/>
            <RowDefinition Height="50*" />
        </Grid.RowDefinitions>
        <TextBox Grid.ColumnSpan="2" Grid.Row="1" Margin="2" Name="txtMessage" IsReadOnly="True" BorderThickness="0"
                 TextWrapping="WrapWithOverflow"
                 Text="{Binding Path=MessageHistory.CurrentItem.Subject}" Background="#FFC6C7FC"  />
        <Image Grid.Row="2" Margin="1" x:Name="imgType"
               Source="{Binding Path=MessageHistory.CurrentItem.Type, Converter={StaticResource cnvSeverity}}" />
        <TextBox Grid.Column="1" Grid.Row="2" Margin="2" Name="txtDetails" IsReadOnly="True" BorderThickness="0"
                 TextWrapping="WrapWithOverflow"
                 Text="{Binding Path=MessageHistory.CurrentItem.Details}" Background="#FFC6C7FC" />

        <Border Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                    BorderBrush="#FFADB2E7" BorderThickness="1" Background="#FF6D74BB">
            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" >
                <Button x:Name="btnClose" HorizontalAlignment="Right" Margin="0,0,3,0" Content="X" 
                    Width="{Binding Height, ElementName=btnClose, Mode=OneWay, FallbackValue=6}" Background="White"
                    Command="{Binding Path=HideInfoCommand}" FontSize="4" />
                <Button x:Name="btnShowException" HorizontalAlignment="Right" Margin="0,0,3,0" Content="EX" 
                    Width="{Binding Height, ElementName=btnShowException, Mode=OneWay, FallbackValue=6}" Background="White"
                    Command="{Binding Path=ShowExceptionCommand}" FontSize="4" />
            </StackPanel>
        </Border>
    </Grid>
</UserControl>
